﻿/**
 * @file guild_auction_timer.h
 * @date 2021/06/21 17:06
 * 
 * @author harrybao (harrybao@123u.com)
 * 
 * @brief 公会拍卖定时器
 * 
 * @version v1.0.0
 * 
 * @copyright Copyright © 2021 All Rights Reserved 上海欢乐互娱网络科技有限公司
 * 
 * @par history:
 * <table>
 * <tr><th>Date                     <th>Version     <th>Author      <th>Description
 * <tr><td>2021/06/21 17:06         <td>1.0.0       <td>harrybao    <td>创建初始版本
 * </table>
 */

#include <cinttypes>

namespace guild_service {

/**
 * @brief 公会拍卖定时器类
 * 
 */
class GuildAuctionTimer {
public:
  GuildAuctionTimer() = default;
  ~GuildAuctionTimer();
public:
  /**
   * @brief 开启定时器
   * 
   * @return true 
   * @return false 
   */
  bool start();
  
  /**
   * @brief 定时是否已经开启
   * 
   * @return true 
   * @return false 
   */
  bool started() const;
  
  /**
   * @brief 关闭定时器
   * 
   * @return true 
   * @return false 
   */
  bool stop();

  void update() {}
private:
  /// 定时器句柄
  uint64_t handler_{0};
};

/// 公会拍卖定时器单例
#define GuildAuctionTimerSingleton(...) \
  (*common::singleton<GuildAuctionTimer>::instance(__VA_ARGS__))
}